import discountApi from "@/api/declaration/mall/discountApi"
import httpRequest from "@/config/axios/httpRequest"
import { DiscountActivityModel } from "@/models/mall/DiscountActivityModel"

// 查询限时折扣活动列表
export const getDiscountActivityPage = async (params) => {
  return await httpRequest.get(discountApi.GetDiscountActivityPage, { params })
}

// 查询限时折扣活动详情
export const getDiscountActivity = async (id: number) => {
  return await httpRequest.get(discountApi.GetDiscountActivity, { params: { id } })
}

// 新增限时折扣活动
export const createDiscountActivity = async (data: DiscountActivityModel) => {
  return await httpRequest.post(discountApi.CreateDiscountActivity, data)
}

// 修改限时折扣活动
export const updateDiscountActivity = async (data: DiscountActivityModel) => {
  return await httpRequest.put(discountApi.UpdateDiscountActivity, data)
}

// 关闭限时折扣活动
export const closeDiscountActivity = async (id: number) => {
  return await httpRequest.put(discountApi.CloseDiscountActivity, { params: { id } })
}

// 删除限时折扣活动
export const deleteDiscountActivity = async (id: number) => {
  return await httpRequest.delete(discountApi.DeleteDiscountActivity, { params: { id } })
}
